package com.pm.web.controller.buglist;


import com.pm.buglist.domain.BugDescription;
import com.pm.buglist.service.BugDescriptionService;
import com.pm.common.annotation.Log;
import com.pm.common.core.controller.BaseController;
import com.pm.common.core.domain.AjaxResult;
import com.pm.common.enums.BusinessType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * bugs描述表 前端控制器
 * </p>
 *
 * @author wwm
 * @since 2023-12-14
 */
@RestController
@RequestMapping("/business/bug-description")
public class BugDescriptionController extends BaseController {

    @Resource
    private BugDescriptionService descriptionService;

    @Log(title = "bugs描述:新增",businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult addDescription(@RequestBody BugDescription description){
        return descriptionService.insertBugDescription(description);
    }

    @Log(title = "bugs描述:修改",businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult updateDescription(@RequestBody BugDescription description){
        return descriptionService.updateBugDescription(description);
    }

    @GetMapping("/bugHandleHistory/{bid}")
    public AjaxResult getBugHandleHistory(@PathVariable("bid") Long bid){
        return descriptionService.getHandleBugHistory(bid);
    }

}

